package com.ssy.lingxi.purchase.api.enums.bidding;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 审核采购竞价结果工作流内部状态枚举
 * @author wrc
 * @date 2021/1/19
 */
public enum BiddingReturnInteriorWorkStateEnum {
    CANCEL(-1, "已作废"),
    COMPLETE(99, "已完成"),
    STAY_SUBMIT_BIDDING(11, "待提交审核竞价结果"),
    STAY_AUDIT_BIDDING1(12, "待审核竞价结果(一级)"),
    STAY_SUBMIT_BIDDING2(13, "待审核竞价结果(二级)"),
    STAY_CONFIRMATION_BIDDING(14, "待确认竞价结果"),
    AUDIT_NOT_BIDDING1(15, "审核竞价结果不通过(一级)"),
    AUDIT_NOT_BIDDING2(16, "审核竞价结果不通过(二级)"),
    ;

    private Integer state;
    private String name;

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.state);
    }

    public void setName(String name) {
        this.name = name;
    }

    BiddingReturnInteriorWorkStateEnum(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    public static String getName(Integer state){
        BiddingReturnInteriorWorkStateEnum workEnum = Arrays.stream(BiddingReturnInteriorWorkStateEnum.values()).filter(v -> v.getState().equals(state)).findAny().orElse(null);
        return null == workEnum ? "" : LanguageHolder.getName(BiddingReturnInteriorWorkStateEnum.class, workEnum.getState());
    }
}
